﻿using System;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Architecture;
using Autodesk.Revit.DB.Mechanical;
using Autodesk.Revit.UI.Selection;

namespace CharacterInc
{
	internal class SelectionFilterTextNote : ISelectionFilter
	{
		public bool AllowElement(Element elem)
		{
			if (elem is TextNote)
			{
				if (((TextNote)elem).get_Parameter(BuiltInParameter.ELEM_CATEGORY_PARAM_MT).AsValueString().Equals("文字注释"))
				{
					return true;
				}
			}
			else if (elem is ModelText)
			{
				if (((ModelText)elem).get_Parameter(BuiltInParameter.ELEM_FAMILY_PARAM).AsValueString().Equals("模型文字"))
				{
					return true;
				}
			}
			else if (elem is RoomTag)
			{
				if (((RoomTag)elem).get_Parameter(BuiltInParameter.ELEM_CATEGORY_PARAM_MT).AsValueString().Equals("房间标记"))
				{
					return true;
				}
			}
			else if (elem is SpaceTag && ((SpaceTag)elem).get_Parameter(BuiltInParameter.ELEM_CATEGORY_PARAM).AsValueString().Equals("空间标记"))
			{
				return true;
			}
			return false;
		}

		public bool AllowReference(Reference reference, XYZ position)
		{
			return true;
		}
	}
}
